package com.itheima;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo01 {
    public static void main(String[] args) {
        System.out.println("1");
        System.out.println("2");
        System.out.println("3");
        System.out.println("4");
//
        ExecutorService threadPool = Executors.newFixedThreadPool(3);
        threadPool.submit(new Student("小明1"));
        threadPool.submit(new Student("小明2"));
        threadPool.submit(new Student("小明3"));
        threadPool.submit(new Student("小明4"));
        threadPool.submit(new Student("小明5"));
        threadPool.submit(new Student("小明6"));
    }
    static class Student implements  Runnable{
        private  String  name;

        public Student(String name) {
            this.name = name;
        }

        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName()+"正在教"+name+"游泳");
           /* try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }*/

        }
    }
}
